<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {string} haystack
 * @param {string} needle
 * @return {number}
 */
var strStr = function(haystack, needle) {
			var arr=[];
    		haystack=haystack.split("");
    		needle=needle.split("");
    		for(var i=0;i<haystack.length-needle.length+1;i++){
    			 arr=[];
    			for(var j=0;j<needle.length;j++){
    				arr.push(haystack[i+j]);
    			};
    			if(needle.join('')===arr.join('')){
    				console.log(i);
    				return i;
    			};
    		};
    		return -1;
		};
</script>
</html>
